<?php

use Fisharebest\Webtrees\Fact;
use Fisharebest\Webtrees\I18N;

/**
 * @var array<Fact> $family_anniversaries
 * @var array<Fact> $individual_anniversaries
 */

?>

<table class="w-100" role="presentation">
    <tr>
        <td class="wt-page-options-label text-center w-50">
            <?= view('icons/individual') ?>
            <?= I18N::plural('%s individual', '%s individuals', $individual_anniversaries->count(), I18N::number($individual_anniversaries->count())) ?>
        </td>

        <td class="wt-page-options-label text-center w-50">
            <?= view('icons/family') ?>
            <?= I18N::plural('%s family', '%s families', $family_anniversaries->count(), I18N::number($family_anniversaries->count())) ?>
        </td>
    </tr>

    <tr>
        <td class="wt-page-options-value align-top">
            <ul class="list-unstyled">
                <?php foreach ($individual_anniversaries as $fact) : ?>
                    <li>
                        <a href="<?= e($fact->record()->url()) ?>">
                            <?= $fact->record()->fullName() ?>
                        </a>

                        <div class="indent">
                            <?= $fact->label() ?> — <?= $fact->date()->display(true, null, false) ?>
                            <?php if ($fact->attribute('PLAC') !== '') : ?>
                                — <?=  $fact->attribute('PLAC') ?>
                            <?php endif ?>
                        </div>
                    </li>
                <?php endforeach ?>
            </ul>
        </td>
        <td class="wt-page-options-value align-top">
            <ul class="list-unstyled">
                <?php foreach ($family_anniversaries as $fact) : ?>
                    <li>
                        <a href="<?= e($fact->record()->url()) ?>">
                            <?= $fact->record()->fullName() ?>
                        </a>

                        <div class="indent">
                            <?= $fact->label() ?> — <?= $fact->date()->display(true, null, false) ?>
                            <?php if ($fact->attribute('PLAC') !== '') : ?>
                                — <?=  $fact->attribute('PLAC') ?>
                            <?php endif ?>
                        </div>
                    </li>
                <?php endforeach ?>
            </ul>
        </td>
    </tr>
</table>
